/* 
 * BAT_GeneTab_private.h
 *
 * Internal functions for use within BAT.c
 *
 * $Id: BAT_private.h 924 2006-09-03 01:19:46Z rpz $
 *
 * Bob Zimmermann <rpz@cse.wustl.edu>
 * Totally free.
 *
 */

#ifndef BAT_PRIVATE_H
#  define BAT_PRIVATE_H

#  include "BAT_Annotation.h"

char _BAT_Strands[STRAND + 1] = {
  '+',
  '-',
  '?'
};
char *_BAT_Feature_Names[FEATURE_TYPE + 1] = {
  "CDS",
  "5UTR",
  "3UTR",
  "start_codon",
  "stop_codon",
  "inter",
  "inter_CNS",
  "intron_CNS",
  "exon",
  "?"
};

/* update the arrays by visiting all the parents to inform them of resizing */
/*void _BAT_Gene_tell_parents(BAT_Gene *);
void _BAT_Transcript_tell_parents(BAT_Transcript * tx);
void _BAT_Feature_tell_parents(BAT_Feature * feat);*/

BAT_Base *_BAT_Base_init(size_t sz, int nallocs, ...);
BAT_Base *_BAT_Base_copy(BAT_Base * o, size_t sz, BAT_Allocator_ID child_id);
void _BAT_Base_delete(BAT_Base * o, int);
void _BAT_Base_set_parent(BAT_Base *, BAT_Base *);
void _BAT_Base_tell_parents(BAT_Base *);
void _BAT_Base_tell_children(BAT_Base *, BAT_State);

void _BAT_Gene_update_minmax(BAT_Gene * gene, BAT_Transcript * tx);
void _BAT_Transcript_update_minmax(BAT_Transcript * tx, BAT_Feature * feat);
void _BAT_Util_renew_alloc(keyed_set_t *, BAT_Allocator_ID, int);
darray_t * _BAT_Util_direct_renew_alloc(darray_t * alloc, BAT_Allocator_ID id, int);

BAT_Feature * _BAT_Feature_Base_init(size_t size);
BAT_Feature * _BAT_Feature_Base_copy(BAT_Feature *o, size_t size);
void _BAT_Feature_Base_delete(BAT_Feature *feat, int);
int _BAT_Feature_Base_order(const void **p1, const void **p2);
int _BAT_Feature_Base_cmp(const BAT_Feature * f1, const BAT_Feature * f2);
void _BAT_Feature_Base_set_all(BAT_Feature * feat, BAT_Feature_Type type,
        BAT_Coord start, BAT_Coord end, int score, int frame);
void _BAT_Feature_Base_set_comment(BAT_Feature * feat, BAT_Comment * cmt);
void _BAT_Feature_Base_set_transcript_id(BAT_Feature *feat, const char *transcript_id);
void _BAT_Feature_Base_set_gene_id(BAT_Feature *feat, const char *gene_id);
void _BAT_Feature_Base_set_attribute_by_keyvalue(BAT_Feature * feat, const char *key,
				      const char *val);
void _BAT_Feature_Base_set_attribute_unchecked(BAT_Feature * feat,
					  BAT_Attribute * attr);

BAT_State _BAT_State_zero();
BAT_State _BAT_State_union(BAT_State s1, BAT_State s2);

void _BAT_GeneTab_update(BAT_GeneTab * bat);
void _BAT_Gene_update(BAT_Gene * gene);
void _BAT_Transcript_update(BAT_Transcript * tx);

#endif /* BAT_PRIVATE_H */
